<template>
	<view class="chatInterface">
		<view class="scroll-view">
			<view class="all-history-loaded">
				更多历史消息
				<!-- {{allHistoryLoaded ? '已经没有更多的历史消息' : '下拉获取历史消息'}} -->
			</view>
			<!--已经收到的消息-->
			<view v-for="(message,index) in messages" :key="message.messageId">
				<!--时间显示，类似于微信，隔5分钟不发言，才显示时间 -->
				<view class="time-lag">{{renderMessageDate(message, index)}} </view>
				<view class="message-admin" v-if="message.senderId == 'admin'">{{message.payload.content}}</view>
				<view class="message-item" v-else :class="{'self' : message.senderId == (currentUser && currentUser.uuid)}">
					<!-- 头像 -->
					<view class="avatar" 
						  v-if="message.senderId != (currentUser && currentUser.uuid)">
						<image style="margin-top: 20rpx;" src="http://47.100.190.24/hfl-files/server.png"></image>
					</view>
					<view class="avatar" v-else>
						<image :src="currentUser.avatar"></image>
					</view>
				<view>
					<view class="friendName" v-if="message.senderId !== currentUser.uuid">{{message.senderId}}</view>
					<view class="content">
						
						<b class="pending" v-if="message.status == 'sending'"></b>
						<b class="send-fail" v-if="message.status == 'fail'"></b>
						<view class="msgText"  v-if="message.type == 'textJson' || message.type == 'json'">{{message.payload.content}}</view>
						<image class="image-content" v-if="message.type == 'imageJson'" :src="message.payload.imageUrl"  @click="showImageFullScreen(message.payload.imageUrl)" mode="widthFix"></image>
						<view class="video-snapshot"  v-if="message.type == 'video'" :data-url="message.payload.video.url" @click="playVideo">
							<image :src="message.payload.thumbnail.url" mode="aspectFit"></image>
							<view class="video-play-icon"></view>
						</view>
						<GoEasyAudioPlayer v-if="message.type =='audioJson'" :src="message.payload.url" :duration="message.payload.duration" />
						
						<view class="custom-message" v-if="message.type == 'order'">
							<view class="title">订单号:{{message.payload.orderCode}}</view>
							<view class="infoG">
								<block v-if="message.payload.picList.length <= 1">
									<image :src="message.payload.picList[0]" mode="widthFix"></image>
								    <view class="inderInfo">
								    	<view class="custom-message-item">{{message.payload.goods}}</view>
								    	<view class="bottomG">
								    		<view class="custom-message-item itemNum">数量: x{{message.payload.number}}</view>
								    		<view class="custom-message-item itemMoney">￥ {{message.payload.price}}</view>
								    	</view>
								    </view>
								</block>
								<block v-else>
									<view class="inderInfo">
										<scroll-view scroll-x="true" class="scroV" show-scrollbar='false'>
												<view class="ImgItem" v-for="(item1, index3) in item.picList" :key="index3">
													<image :src="item1" mode="aspectFill" 
													></image>
												</view>
										</scroll-view>
										<view class="bottomG">
											<view class="custom-message-item itemNum">数量: x{{message.payload.number}}</view>
											<view class="custom-message-item itemMoney">￥ {{message.payload.price}}</view>
										</view>
									</view>
								</block>
								
							</view>
							<view class="ItemAction">
								<view class="lab1">
									是否是咨询该订单?
								</view>
								<view v-if="message.payload.btnType" class="ItemActionBtn" @click="btnItemActionBtnClick(index)">发送</view>
								<view v-else class="ItemActionBtn ItemActionBtnCancle">已发送</view>
							</view>
						</view>
						<!-- <view class="unlimitedAfterSales">
							<view>您可以点击连接</view>
							<view class="onlineAfterSales" @click="btnOnlineAfterSales">在线换货</view>
						</view> -->
						<view class="custom-message" v-if="message.type == 'afterSales'">
							<view class="titleG">
								<view class="lab1">
									服务单号:{{message.payload.orderCode}}
								</view>
								<view class="lab2">
									换货
								</view>
							</view>
							<view class="infoG">
								<block v-if="message.payload.picList.length <= 1"></block>
								<image src="../../static/goods.png" mode="widthFix"></image>
								<view class="inderInfo">
									<view class="bottomG">
										<view class="custom-message-item">{{message.payload.goods}}</view>
										<view class="custom-message-item itemNum">{{message.payload.orderNum}}件</view>
									</view>
									<view class="bottomG">
										<view class="showSize">
											<view class="lab1">
												规格
											</view>
											<view class="newSize">
												
											</view>
											<view class="selectType">
												
											</view>
										</view>
										<view class="custom-message-item itemMoney">￥{{message.payload.price}}</view>
									</view>
								</view>
							</view>
							<view class="ItemAction">
								<view class="lab1">
									是否确认本次服务内容？
								</view>
								<view class="ItemActionBtn" @click="btnItemActionBtnClick">确认</view>
								<view class="ItemActionBtn ItemActionBtnCancle" @click="btnItemActionBtnClick">否定</view>
							</view>
						</view>
					</view>
				</view>
				</view>
			</view>
		</view>
		<view class="action-box" v-if="!video.visible">
			<!-- 录音 -->
			<view class="action-top">
				<view :class="[audio.visible ? 'record-icon record-open':'record-icon']" @click="switchAudioKeyboard"></view>
				<view class="record-input" @touchstart="onRecordStart" @touchend="onRecordEnd" v-if="audio.visible" >{{audio.recording ? '松开发送' : '按住录音'}}</view>
				<view class="message-input" v-else>
					<!-- GoEasyIM最大支持3k的文本消息，如需发送长文本，需调整输入框maxlength值 -->
					<input type="text" maxlength="700" placeholder="发送消息" v-model="content" @focus="messageInputFocusin">
				</view>
				
				<view class="btnShowMore" @click="showMore">
					<image src="../../static/btnShowMore.png" mode=""></image>
				</view>
				<span class="btnSend" @click="sendTextMessage" v-if="!audio.visible">发送</span>
			</view>
			<!--更多-->
			<view class="action-bottom" v-if="more.show">
				<view class="more-item" @click="sendImage">
					<image src="../../static/xiangche.png"></image>
					<text>相册</text>
				</view>
				<view class="more-item" @click="sendVideo">
					<image src="../../static/paizhao.png"></image>
					<text>拍照</text>
				</view>
				<view class="more-item" @click="showCustomMessageForm">
					<image src="../../static/itemOrder.png"></image>
					<text>订单</text>
				</view>
			</view>
		</view>
		<!-- 录音动画 -->
		<view class="record-loading" v-if="audio.recording"></view>
		<video v-if="video.visible" :src="video.url" id="videoPlayer" @fullscreenchange="onVideoFullScreenChange"></video>
	</view>
</template>

<script>
	import permision from "@/js_sdk/wa-permission/permission.js"
	import GoEasyAudioPlayer from "@/components/GoEasyAudioPlayer/GoEasyAudioPlayer";
	const recorderManager = uni.getRecorderManager();
	import {initIm,getHistoryImLogsPageList,uesrQueryById} from '../../api/index.js'
    import {mixin} from "../../static/js/mixin.js"
	import IMService from "../../util/imservice.js";
	export default {
		mixins:[mixin], //混入文件
		name: "privateChat",
		components : {
			GoEasyAudioPlayer,
		},
		data() {
			
			return {
				
				friend: null,
				currentUser: null,
				//已经接收到的消息
				messages: [],
				messagesHistory:[],
				total:0,
				pageIndex:1,
				content:'',
				userId:'',
				account:'',
				sessionId:'',
				imageUploadUrl:'',
				//已经加载完所有历史消息
				allHistoryLoaded: true,
				more : {//更多按钮
					show : false
				},
				audio : {
					//语音录音中
					recording : false,
					//录音按钮展示
					visible : false
				},
				
				video : {
					visible : false,
					url : '',
					context : null
				}
			}
		},
		onReady () {
			this.video.context = uni.createVideoContext('videoPlayer',this);
		},
		onShow () {
			this.more.show = false;
			
		},
		onLoad(options) {
			
			
			/*
			接口名：onlineStatus，参数：{account":17625019917,"onlineStatus":0-下线 1-在线,"izKf":0:否 1:是} 状态都是String类型@刘仰渠～开发
			*/
			
			this.userId = getApp().globalData.userId;
			let account = uni.getStorageSync('userName');
			this.initGoEasy(account);
			
			this.account = account
			
			
			this.imageUploadUrl = getApp().globalData.baseUrl +'/manage/sys/common/upload?isup=1'
			let imService = getApp().globalData.imService;
			
			 this.getUesrQueryById()
			 let  currentUser = {};
			 currentUser.name = account;
			 currentUser.uuid = account;
			 currentUser.avatar = 'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png';
			 this.currentUser = currentUser;
			 
			//聊天对象
			this.friend={name:'admin',uuid:'admin',avatar:'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png'}
            //从服务器获取最新的好友信息
   //          this.friend = imService.findFriendById(friendId);
			// this.messages = imService.getPrivateMessages(currentUser.uuid);
			this.requestInitIm();
			//监听新消息
			// this.markPrivateMessageAsRead(this.currentUser.uuid);
			// this.requestGetHistoryImLogsPageList()
			imService.onNewPrivateMessageReceive =  (friendId, message)=> {
				
				  console.log('NewPrivate',message)
				   // debugger
				   
				   this.messages.push(message);
				  
				   this.sessionId = message.payload.sessionId
				   if (message.senderId !== currentUser.uuid) {
					   console.log('message.senderId',message.senderId)
				   	   this.friend.uuid = message.senderId
				   }
				   console.log('_this.senderId', this.friend.uuid,)
				 
                    //聊天时，收到消息标记为已读
					this.markPrivateMessageAsRead(friendId);
					//收到新消息，是滚动到最底部
					this.scrollToBottom()
				
			};
			//每次进入聊天页面，总是滚动到底部
			this.scrollToBottom();
            // 录音监听器
            this.initRecorderListeners();
			//收到的消息设置为已读
			// if(this.messages.length !==0){
			// 	this.markPrivateMessageAsRead(this.currentUser.uuid);
			// }
			
			
			// 监听事件
			// uni.$on('onlineAfter',(dict)=>{
			// 	// console.log('stockAndLocs->',dict)
			//     this.stockDict = {...this.stockDict,...dict}	   
			// }) 
			
		},
		onPullDownRefresh() {
			
			// if (this.total > this.pageIndex*40) {
				
				this.requestGetHistoryImLogsPageList()
				
			// }
		
		},
		onUnload() {
			this.goeasyDisconnect();
			//退出聊天页面之前，清空页面传入的监听器
			let imService = getApp().globalData.imService;
			if(imService) {
				imService.onNewPrivateMessageReceive =  (friendId, message)=> {};
				getApp().globalData.imService= null
			}
			
			
		},
		filters:{
		  	avatarImg: function(param) {
				
				if (param) {
				   return	param.indexOf('http') > -1 ? param : 'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png';
				} else{
					return 'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png'
				}
				
			}
		},
		methods: {
			async requestInitIm(){
				
				let {result} = await initIm({
					izKf:'0',
					userAccount:this.account
				})
				if (result.imLogs) {
					
					let arr = result.imLogs.map(v=>{
						v.status = 'success'
						v.messageId = v.id
						v.payload = JSON.parse(v.content)
						// v.senderId = v.fromAccount
						v.type = v.msgType
						return v
					})
					this.messages = arr.concat(this.messages);
					
				}
				
				if (result.sessionId) {
					this.friend.uuid =  result.kfAccount
					this.sessionId = result.sessionId
					this.markPrivateMessageAsRead(this.friend.uuid);
				}else{
					// this.messages =[]
					this.friend={name:'admin',uuid:'admin',avatar:'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png'}
					this.markPrivateMessageAsRead('admin');
				}
               	
			},
			// 获取历史记录
			async requestGetHistoryImLogsPageList() {
				
				try{
					let {result} = await getHistoryImLogsPageList({
						pageNo:this.pageIndex,
						pageSize:'40',
						// sessionId:this.sessionId
					})
					
					// this.markPrivateMessageAsRead(this.currentUser.uuid);
					if (result) {
						
					this.pageIndex ++
					
					let arr = result.records.map(v=>{
						v.status = 'success'
						v.messageId = v.id
						v.payload = JSON.parse(v.content)
						// v.senderId = v.fromAccount
						v.type = v.msgType
						return v
					})
					this.messages = arr.concat(this.messages);
					
					/*
					setTimeout(()=>{
						let messagesLength = this.messages.length
						let arrLength = arr.length
						if (messagesLength && arrLength) {
							
						    if (this.messages[messagesLength-1].timestamp<arr[0].timestamp) {
						    	this.messages = this.messages.concat(arr);
						    } else if (this.messages[0].timestamp>arr[arrLength-1].timestamp){
						    	this.messages = arr.concat(this.messages);
						    }else{
								
								let middleArr = arr.concat(this.messages);
							    this.messages = middleArr.sort(function(a,b){
									return a.timestamp - b.timestamp
								})
							}
							
						}else{
							this.messages = this.messages.concat(arr);
						}
						
						
					},300)
					*/
					
					
					this.total = result.total
					if (result.total > this.pageIndex*40) {
						this.allHistoryLoaded = false
					} else{
						this.allHistoryLoaded =true
					}
					
					}
					uni.stopPullDownRefresh()
				}catch(e){
					//TODO handle the exception
					uni.stopPullDownRefresh()
				}
				
				
				
			},
			// 获取头像信息
			async getUesrQueryById() {
				    try {
						let {result} = await uesrQueryById({
				
							id:this.userId
						});
					if (result.url) {
					 this.currentUser.avatar = result.url
					}
					
					} catch (err) {
						// console.log('zjk:', err);
					}
					
					
				
			},
			initGoEasy(name){
				
					let dict={};
					dict.name = name;
					dict.uuid = name;
					dict.avatar = 'http://dl.hgtplat.com/banjo/picture/Fplaceholder1.png';
					
					if(this.goEasy.getConnectionStatus() === 'disconnected') {
						console.log('initIMService')
						getApp().globalData.imService= new IMService(this.goEasy,this.GoEasy);
						getApp().globalData.imService.connect(dict);
					}
			},
            goeasyDisconnect(){
				//断开连接
			   this.goEasy.disconnect({
					onSuccess: function(){
						console.log("GoEasy disconnect successfully.")
					},
					onFailed: function(error){
						console.log("Failed to disconnect GoEasy, code:"+error.code+ ",error:"+error.content);
					}
				});
			},
            //像微信那样显示时间，如果有几分钟没发消息了，才显示时间
            //todo:本不需要该方法，可以在标签里完成，但小程序有兼容性问题，被迫这样实现
            renderMessageDate(message, index) {
                if (index === 0) {

			      return this.formatDate(message.timestamp)

                } else {
					
                    if (message.timestamp - this.messages[index - 1].timestamp > 300000) {
                        return this.formatDate(message.timestamp)
                    }
                }
                return '';
            },
			initRecorderListeners(){
				// 监听录音开始
				recorderManager.onStart(() => {
					this.audio.recording = true;
				});
				
				//录音结束后，发送
				recorderManager.onStop((res) => {
					this.audio.recording = false;
					if (res.duration < 1000) {
						
						uni.showToast({
							icon:'none',
							
							title:'说话时间太短'
						},1500)
						
					} else{
						
					this.asyncUpload(res.tempFilePath,'audio',res)
						
					}
				});
				// 监听录音报错
				recorderManager.onError((res)=>{
					console.log("录音报错：",res);
					this.audio.recording = false
					
					uni.showToast({
						icon:'none',
						title:'录音失败'
					})
					
					
				})
			},
			//创建录音会话
			customAudioMessage(url,resInfo){
				let customMessage = this.goEasy.im.createCustomMessage({
				    type : 'audioJson',
				    payload : {
				        url : url,
						duration:resInfo.duration/1000,
				        sessionId:this.sessionId,
						avatar:this.currentUser.avatar
						
				    },
				    to : {
				        id :this.friend.uuid,
				        type : this.GoEasy.IM_SCENE.PRIVATE,
				        data : {
				        	name:this.friend.name,
				        	avatar:this.friend.avatar
				        }
				    },
				    notification : {
				        title : this.currentUser.name + '发来一个消息',
				        body : '[图片消息]'     // 字段最长 50 字符
				    }
				});
				
				this.sendMessage(customMessage);
				this.keepMessage(customMessage);
			},
			sendMessage(message){
            	// let toId = message.to.id;
				// console.log("sendMessage", message);
            	
				this.goEasy.im.sendMessage({
					message: message,
					onSuccess: function (message) {
						console.log("发送成功.", message);
					},
					onFailed: function (error) {
						console.log("发送失败:",error);
					}
				});
			},
			//保存数据
			keepMessage(message){
				// let imService = getApp().globalData.imService;
				// let localHistory = imService.getPrivateMessages(this.currentUser.uuid);
				// localHistory.push(message);
				this.messages.push(message);
			},
			btnItemActionBtnClick(index){
				
				let message = this.messages[index];
				message.payload.btnType = false;
				this.sendMessage(message);
			
				
			},
			//在线退货
			btnOnlineAfterSales(){
				uni.navigateTo({
					url:'../applyAftersales/applyAftersales'
				})
			},
			sendTextMessage() {//发送消息
				if (this.content.trim() !== '') {
					let body = this.content;
					if(this.content.length >= 50){
						body = this.content.substring(0,30)+"...";
					}
					// console.log('this.friend',this.friend);
					let customMessage = this.goEasy.im.createCustomMessage({
					    type : 'textJson',
						status:'',
					    payload : {
					        content : this.content,
					        sessionId:this.sessionId,
							avatar:this.currentUser.avatar
					    },
					    to : {
					        id :this.friend.uuid,
					        type : this.GoEasy.IM_SCENE.PRIVATE,
					        data : {
					        	name:this.friend.name,
					        	avatar:this.friend.avatar
					        }
					    },
					    notification : {
					        title : this.currentUser.name + '发来一个消息',
					        body : '[文字消息]'     // 字段最长 50 字符
					    }
					});
					// debugger
					this.keepMessage(customMessage);
					this.sendMessage(customMessage);
				}
				this.scrollToBottom();
				this.content = "";
			},
			//语音录制按钮和键盘输入的切换
			switchAudioKeyboard() {
				this.audio.visible = !this.audio.visible;
				if(uni.authorize){
					uni.authorize({
						scope : 'scope.record'
					})
				}
			},
			
				
			async audioAndrod(){
				let result = await permision.requestAndroidPermission('android.permission.RECORD_AUDIO')
				// 已授权
				if (result == 1) {
					this.onRecordStart1()
				}else{
				
					uni.showModal({
						title:'提示！',
						content:'APP需要您的麦克风权限，来发送语音',
						success: (resInfo) => {
							if (resInfo.confirm) {
								
							permision.gotoAppPermissionSetting()
								
							}
						}
					})
				}
				
			},
			async audioIos(){
				let result = await permision.judgeIosPermission('record')
				// 已拒绝
				if (result == -1) {
					
					uni.showModal({
						title:'提示！',
						content:'APP需要您的麦克风权限，来发送语音',
						success: (resInfo) => {
							if (resInfo.confirm) {
								
							permision.gotoAppPermissionSetting()
								
							}
						}
					})
					 
				}else{
					this.onRecordStart1()
				}
			},
			//加入权限判断
			onRecordStart(){
				
				// #ifdef APP-PLUS
				
				let platform = uni.getSystemInfoSync().platform
				
			    if(platform == 'android'){
					
					this.audioAndrod()
				}else{
					this.audioIos()
					// this.onRecordStart1()
				}
				// #endif
				
				
			    // #ifdef MP-WEIXIN
			      this.onRecordStart1()
			    // #endif
				
			},
			onRecordStart1 () {
				
			
				try{
					
					recorderManager.start();
				}catch(e){
					uni.showModal({
						title: '录音错误',
						content : '请在app和小程序端体验录音，Uni官方明确H5不支持getRecorderManager, 详情查看Uni官方文档'
					});
				}
			},
			onRecordEnd () {
				try{
					recorderManager.stop();
				}catch(e){
					console.log(e)
				}
			},
			sendVideo () {//发送文件
				uni.chooseVideo({
					success : (res) => {
						let videoMessage = this.goEasy.im.createVideoMessage({
							to : {
								id : this.friend.uuid,
								type : this.GoEasy.IM_SCENE.PRIVATE,
								data : {
									name:this.friend.name,
									avatar:this.friend.avatar
								}
							},
							file: res,
							onProgress :function (progress) {
								console.log(progress)
							},
							notification : {
								title : this.currentUser.name + '发来一个视频',
								body : '[视频消息]'		// 字段最长 50 字符
							}
						});
						this.sendMessage(videoMessage);
					}
				})
			},
			customImageMessage(url){
				
				let customMessage = this.goEasy.im.createCustomMessage({
				    type : 'imageJson',
				    payload : {
				        imageUrl : url,
				        sessionId:this.sessionId,
						avatar:this.currentUser.avatar
				    },
				    to : {
				        id :this.friend.uuid,
				        type : this.GoEasy.IM_SCENE.PRIVATE,
				        data : {
				        	name:this.friend.name,
				        	avatar:this.friend.avatar
				        }
				    },
				    notification : {
				        title : this.currentUser.name + '发来一个消息',
				        body : '[图片消息]'     // 字段最长 50 字符
				    }
				});
				
				this.sendMessage(customMessage);
				this.keepMessage(customMessage);
				
			},
			showImageFullScreen (e) {
				// console.log('e',e);
				uni.previewImage({
					current:0,
					urls: [e]
				});
				
			},
			playVideo (e) {
				this.video.visible = true;
				this.video.url = e.currentTarget.dataset.url;
				this.$nextTick(() => {
					this.video.context.requestFullScreen({
						direction : 0
					});
					this.video.context.play();
				});
			},
			onVideoFullScreenChange (e) {
				//当退出全屏播放时，隐藏播放器
				if(this.video.visible && !e.detail.fullScreen){
				    this.video.visible = false;
				    this.video.context.stop();
				}
			},
			messageInputFocusin () {
				this.more.show = false;
				
			},
			
			showMore () {
				this.more.show = !this.more.show;
				
			},
			
			showCustomMessageForm () {
            	
				let _this = this
				uni.$on('orderAll', function(data) {
					// data即为传过来的值
					console.log(data);
					 // _this.addressData = data;
					 _this.sendOrderInfo(data);
					//清除监听，不清除会消耗资源
					uni.$off('orderAll');
					
				});
				
				uni.navigateTo({
					url: '../orderAll/orderAll'
				});
			},
			sendOrderInfo(data){
				let customMessage = this.goEasy.im.createCustomMessage({
					type : 'order',
					payload : {
						orderCode : data.orderCode,
						number : data.orderNum,
						goods: data.goodsName,
						price : data.totalPrice,
						picList : data.picList,
						sessionId:this.sessionId,
						btnType:true    ,//按钮是否可点 
						avatar:this.currentUser.avatar
						
					},
					to : {
						id :this.friend.uuid,
						type : this.GoEasy.IM_SCENE.PRIVATE,
						data : {
							name:this.friend.name,
							avatar:this.friend.avatar
						}
					},
					notification : {
						title : this.currentUser.name + '发来一份订单',
						body : '[订单消息]'     // 字段最长 50 字符
					}
				});
				this.keepMessage(customMessage);
			},
			scrollToBottom () {
				this.$nextTick(function(){
					uni.pageScrollTo({
						scrollTop: 2000000,
						duration : 10
					})
				});
			},
			markPrivateMessageAsRead (friendId) {
				this.goEasy.im.markPrivateMessageAsRead({
					userId: friendId,
					onSuccess: function () {
						console.log('标记为已读成功')
					},
					onFailed: function (error) {
						console.log(error);
					}
				});
			}
		}
	}
</script>
<style scoped>
	@import '@/util/chatInterface.css';
</style>
<style lang="less">
	page{
		
		background-color: #F8F9FD;
	}
	.btnShowMore{
		margin:0 20rpx;
		width: 50rpx;
		height: 50rpx;
		
        image{
			width: 100%;
			height: 100%;
		}
	}
	.btnSend{
		width: 114rpx;
		height: 58rpx;
		background: linear-gradient(135deg, #2D63F9 0%, #6421D3 100%);
		border-radius: 6px;
		text-align: center;
		line-height: 58rpx;
		color: #fff;
		font-size: 28rpx;
	}
	.sendBtn{
		width: 100rpx;
		height: 100rpx;
		line-height: 100rpx;
		text-align: center;
		background: linear-gradient(135deg, #2D63F9 0%, #6421D3 100%);
		border-radius: 50%;
		color: #fff;
		position: fixed;
		right: 20rpx;
	    bottom: 150rpx;
		z-index: 5;
}
.friendName{
	margin-bottom: 10rpx;
}
.message-admin{
	text-align: center;
	font-size: 28rpx;
	padding: 30rpx;
	color: #666;
}
.unlimitedAfterSales{
	display: flex;
	align-items: center;
	padding: 28rpx 32rpx;
	font-size: 24px;
	font-weight: 400;
	color: #333333;

}
.unlimitedAfterSales  .onlineAfterSales{
	color: #548CE7;
}
</style>
